import request from '@/utils/request';

/**
 * 分页查询用户
 */
export async function get_list(params) {
  const res = await request.post('/purchase/alter_goods_log/get_list', {
    ...params
  });
  if (res.data.code === 1) {
	res.data.data.row_list.forEach(item=>{
		Object.keys(item).forEach(key=>{
			if(Array.isArray(item[key])){
				let newkey1 = key+'_before';
				let newkey2 = key+'_after';
				item[newkey1] = item[key][0];
				item[newkey2] = item[key][1];
			}
		})
	})
    return {
      list: res.data.data.row_list,
      columns: res.data.data.columns,
      searchData: res.data.data.search_area,
      count: res.data.data.page_info?.total,
      top_button: res.data.data.top_button
    };
  }
  return Promise.reject(res.data.msg);
}

